package com.zzyl.generator.util;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;

import java.io.FileWriter;
import java.io.IOException;

public class Test {
    public static void main(String[] args) throws IOException {
        //1. 初始化模板引擎
        VelocityInitializer.initVelocity();
        //2. 获取模板
        Template template = Velocity.getTemplate("vms/index.html.vm");
        //3. 准备填充内容
        VelocityContext context = new VelocityContext();
        context.put("message", "!!!");
        //4. 合并 , 使用输入流合并
        //输入流
        FileWriter fw = new FileWriter("D:\\index.html");
        template.merge(context, fw);
        //关流
        fw.close();
    }
}
